-
Notifications
You must be signed in to change notification settings - Fork 14.7k
RuntimeLibcalls: Move __stack_chk_fail config to tablegen #148789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeLibcalls: Move __stack_chk_fail config to tablegen #148789
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-tablegen @llvm/pr-subscribers-backend-arm Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/148789.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index af339e2a55cf2..4d7d0fbd1a511 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -18,6 +18,7 @@ class DuplicateLibcallImplWithPrefix<RuntimeLibcallImpl Impl, string prefix>
/// Libcall Predicates
def isOSDarwin : RuntimeLibcallPredicate<"TT.isOSDarwin()">;
def isOSOpenBSD : RuntimeLibcallPredicate<"TT.isOSOpenBSD()">;
+def isNotOSOpenBSD : RuntimeLibcallPredicate<"!TT.isOSOpenBSD()">;
def isOSWindows : RuntimeLibcallPredicate<"TT.isOSWindows()">;
def isNotOSWindows : RuntimeLibcallPredicate<"!TT.isOSWindows()">;
def isNotOSMSVCRT : RuntimeLibcallPredicate<"!TT.isOSMSVCRT()">;
@@ -698,9 +699,6 @@ foreach lc = LibCalls__atomic in {
def __#!tolower(!cast<string>(lc)) : RuntimeLibcallImpl<lc>;
}
-// Stack Protector Fail
-def __stack_chk_fail : RuntimeLibcallImpl<STACKPROTECTOR_CHECK_FAIL>;
-
// Deoptimization
def __llvm_deoptimize : RuntimeLibcallImpl<DEOPTIMIZE>;
@@ -945,6 +943,9 @@ def exp10l_f80 : RuntimeLibcallImpl<EXP10_F80, "exp10l">;
def exp10l_f128 : RuntimeLibcallImpl<EXP10_F128, "exp10l">;
def exp10l_ppcf128 : RuntimeLibcallImpl<EXP10_PPCF128, "exp10l">;
+// Stack Protector Fail
+def __stack_chk_fail : RuntimeLibcallImpl<STACKPROTECTOR_CHECK_FAIL>;
+
//--------------------------------------------------------------------
// compiler-rt/libgcc but 64-bit only, not available by default
//--------------------------------------------------------------------
@@ -1128,6 +1129,7 @@ defvar LibmHasLdexpF80 = LibcallImpls<(add ldexp_f80), isNotOSWindowsOrIsCygwinM
defvar LibmHasFrexpF128 = LibcallImpls<(add frexp_f128), isNotOSWindowsOrIsCygwinMinGW>;
defvar LibmHasLdexpF128 = LibcallImpls<(add ldexp_f128), isNotOSWindowsOrIsCygwinMinGW>;
+defvar has__stack_chk_fail = LibcallImpls<(add __stack_chk_fail), isNotOSOpenBSD>;
//===----------------------------------------------------------------------===//
// Objective-C Runtime Libcalls
@@ -1205,7 +1207,8 @@ def AArch64SystemLibrary : SystemRuntimeLibrary<
LibcallImpls<(add bzero), isOSDarwin>,
DarwinExp10, DarwinSinCosStret,
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
- LibmHasExp10F32, LibmHasExp10F64, LibmHasExp10F128)
+ LibmHasExp10F32, LibmHasExp10F64, LibmHasExp10F128,
+ has__stack_chk_fail)
>;
// Prepend a # to every name
@@ -1481,7 +1484,8 @@ def ARMSystemLibrary
// Use divmod compiler-rt calls for iOS 5.0 and later.
LibcallImpls<(add __divmodsi4, __udivmodsi4),
RuntimeLibcallPredicate<[{TT.isOSBinFormatMachO() &&
- (!TT.isiOS() || !TT.isOSVersionLT(5, 0))}]>>)> {
+ (!TT.isiOS() || !TT.isOSVersionLT(5, 0))}]>>,
+ has__stack_chk_fail)> {
let DefaultLibcallCallingConv = LibcallCallingConv<[{
(!TT.isOSDarwin() && !TT.isiOS() && !TT.isWatchOS() && !TT.isDriverKit()) ?
(FloatABI == FloatABI::Hard ? CallingConv::ARM_AAPCS_VFP
@@ -1976,7 +1980,8 @@ def PPCSystemLibrary
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
LibmHasSinCosPPCF128,
AvailableIf<memcpy, isNotAIX>,
- LibcallImpls<(add Int128RTLibcalls), isPPC64>)>;
+ LibcallImpls<(add Int128RTLibcalls), isPPC64>,
+ has__stack_chk_fail)>;
//===----------------------------------------------------------------------===//
// RISCV Runtime Libcalls
@@ -1990,7 +1995,8 @@ def RISCVSystemLibrary
(add DefaultRuntimeLibcallImpls,
exp10f, exp10, exp10l_f128,
__riscv_flush_icache,
- LibcallImpls<(add Int128RTLibcalls), isRISCV64>)>;
+ LibcallImpls<(add Int128RTLibcalls), isRISCV64>,
+ has__stack_chk_fail)>;
//===----------------------------------------------------------------------===//
// SPARC Runtime Libcalls
@@ -2057,7 +2063,8 @@ def SPARCSystemLibrary
sparc_umul, sparc_div, sparc_udiv, sparc_rem, sparc_urem,
LibcallImpls<(add _Q_qtoll, _Q_qtoull, _Q_lltoq, _Q_ulltoq), isSPARC32>,
LibcallImpls<(add SPARC64_MulDivCalls, Int128RTLibcalls), isSPARC64>,
- LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128)
+ LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
+ has__stack_chk_fail)
>;
//===----------------------------------------------------------------------===//
@@ -2106,7 +2113,8 @@ defvar X86CommonLibcalls =
LibcallImpls<(add MostPowI), isNotOSMSVCRT>,
// FIXME: MSVCRT doesn't have powi. The f128 case is added as a
// hack for one test relying on it.
- __powitf2_f128
+ __powitf2_f128,
+ has__stack_chk_fail
);
defvar Windows32DivRemMulCalls =
@@ -2251,7 +2259,8 @@ def WasmSystemLibrary
(add DefaultRuntimeLibcallImpls, Int128RTLibcalls,
CompilerRTOnlyInt64Libcalls, CompilerRTOnlyInt128Libcalls,
exp10f, exp10,
- emscripten_return_address)>;
+ emscripten_return_address,
+ __stack_chk_fail)>;
//===----------------------------------------------------------------------===//
// Legacy Default Runtime Libcalls
@@ -2274,5 +2283,6 @@ def LegacyDefaultSystemLibrary
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
exp10f, exp10, exp10l_f128,
__powisf2, __powidf2, __powitf2_f128,
- LibcallImpls<(add Int128RTLibcalls), isArch64Bit>
+ LibcallImpls<(add Int128RTLibcalls), isArch64Bit>,
+ has__stack_chk_fail
)>;
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 8ca31dff900cb..12aa9dc8d3943 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -77,10 +77,6 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
setLibcallImpl(RTLIB::UNWIND_RESUME, RTLIB::_Unwind_SjLj_Resume);
}
- if (TT.isOSOpenBSD()) {
- setLibcallImpl(RTLIB::STACKPROTECTOR_CHECK_FAIL, RTLIB::Unsupported);
- }
-
if (TT.isARM() || TT.isThumb()) {
setARMLibcallNames(*this, TT, FloatABI, EABIVersion);
return;
|
d9e08a6
to
4717482
Compare
39867e3
to
b5bbf7f
Compare
4717482
to
407ba2c
Compare
407ba2c
to
7bf2a69
Compare
b5bbf7f
to
0b21d22
Compare
7bf2a69
to
dfa00ac
Compare
dfa00ac
to
960cd88
Compare
0b21d22
to
9404c93
Compare
960cd88
to
a6d0dbe
Compare
9404c93
to
20a6035
Compare
a6d0dbe
to
919deef
Compare
bd93ef9
to
0c1bb90
Compare
fd401dd
to
a2730b8
Compare
Merge activity |
a2730b8
to
5ff344f
Compare
5ff344f
to
9346233
Compare
This broke compiling for arm64ec mingw (https://github.com/mstorsjo/llvm-mingw/actions/runs/16738033027/job/47380762274): void other(void *ptr);
void func(void) {
char buf[10];
other(buf);
} $ clang -target arm64ec-windows-gnu -c stacksmash-repro.c -fstack-protector-strong
fatal error: error in backend: unsupported library call operation |
|
No description provided.